package org.jackysoft.interceptor;

import java.lang.reflect.Method;

import com.opensymphony.xwork2.ActionInvocation;

public class BatchUpdateInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = -752337331709387121L;
	@Override
	public String intercept(ActionInvocation arg0) throws Exception {
		String rst = super.intercept(arg0);
		if(VALIDATED.equals(rst)){
			return VALIDATED;
		}
					
		Method serviceUpdateBean = service.getClass().getMethod("update", java.util.Collection.class);
		
		serviceUpdateBean.invoke(service, beans);
		
		return arg0.invoke();
	}
}
